Skip to content

fix syntax warnings in reverse_cron#110

Open
apollo13 wants to merge 1 commit intoaleiepure:mainfrom
apollo13:patch-1
Open

fix syntax warnings in reverse_cron#110
apollo13 wants to merge 1 commit intoaleiepure:mainfrom
apollo13:patch-1

Conversation

@apollo13
Copy link

regular expressions should use raw strings, otherwise backslashes would have to be escaped. This is nowadays a warning (SyntaxWarning: invalid escape sequence '\D'), but will turn into an error in the future.

This is what I see on the console without using raw strings:

/app/share/devtoolbox/devtoolbox/views/reverse_cron.py:323: SyntaxWarning: invalid escape sequence '\D'
  starting_day = re.sub("\D", "", self._day_every_x_starting_dropdown.get_selected_item().get_string())
/app/share/devtoolbox/devtoolbox/views/reverse_cron.py:324: SyntaxWarning: invalid escape sequence '\D'
  interval = re.sub("\D", "", self._day_every_x_dropdown.get_selected_item().get_string())
/app/share/devtoolbox/devtoolbox/views/reverse_cron.py:336: SyntaxWarning: invalid escape sequence '\D'
  x = re.sub("\D", "", self._day_range_x_dropdown.get_selected_item().get_string())
/app/share/devtoolbox/devtoolbox/views/reverse_cron.py:337: SyntaxWarning: invalid escape sequence '\D'
  y = re.sub("\D", "", self._day_range_y_dropdown.get_selected_item().get_string())

regular expressions should use raw strings, otherwise backslashes would have to be escaped. This is nowadays a warning (SyntaxWarning: invalid escape sequence '\D'), but will turn into an error in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant